import request from '@/utils/request';

const cpfService = {
    // 员工cpf列表 -> 陈炎彬
    async getCPFEmployeeList(params) {
        return request('/api/finance/salary/v1/setting/cpf/employee/list', {
            method: 'POST',
            data: params
        });
    },

    // CPF档案列表 -> 陈炎彬
    async getCpfList(params) {
        return request('/api/finance/salary/v1/setting/cpf/list', {
            method: 'GET',
            params
        });
    },

    //  CPF档案详情列表 -> 陈炎彬
    async getCpfDetailList(params) {
        return request('/api/finance/salary/v1/setting/cpf/detail/list', {
            method: 'GET',
            params
        });
    },

    // cpf档案--审批详情 -> 陈炎彬
    async getCpfApproveInfo({ cpfId }) {
        return request(`/api/finance/salary/v1/setting/cpf/approve/detail/${cpfId}`, {
            method: 'GET'
        });
    },

    /** CPF档案详情-新增(批量) -> 陈炎彬 */
    async batchSaveDetail(params) {
        return request('/api/finance/salary/v1/setting/cpf/detail', {
            method: 'POST',
            data: params
        });
    },

    // CPF档案详情-更新
    async updateCpfDetail(params) {
        return request('/api/finance/salary/v1/setting/cpf/detail', {
            method: 'PUT',
            data: params
        });
    },

    // PF档案详情-删除 -> 陈炎彬
    async deleteCpfDetail({ cpfId, id }) {
        return request(`/api/finance/salary/v1/setting/cpf/detail/${cpfId}/${id}`, {
            method: 'DELETE'
        });
    },

    // CPF档案明细详情 ->  陈炎彬
    async getCpfDetail({ id }) {
        return request(`/api/finance/salary/v1/setting/cpf/detail/${id}`, {
            method: 'GET'
        });
    },

    // CPF档案-重置 ->  陈炎彬
    async resetCpf({ cpfId }) {
        return request(`/api/finance/salary/v1/setting/cpf/reset/${cpfId}`, {
            method: 'GET'
        });
    },

    /**
     * 申请前校验 ->  陈炎彬
     * @param cpfId cpf主表Id
     */
    async validateBeforeApply({ cpfId }) {
        return request(`/api/finance/salary/v1/setting/cpf/check/${cpfId}`, {
            method: 'GET'
        });
    }
};

export default cpfService;
